#version 400

layout(triangles, fractional_even_spacing, cw) in;


uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;

in vec3 tcPosition[];

out vec3 tePosition;

void main()
{
	vec3 p0 = gl_TessCoord.x * tcPosition[0];
    vec3 p1 = gl_TessCoord.y * tcPosition[1];
    vec3 p2 = gl_TessCoord.z * tcPosition[2];

	tePosition = vec3(p0 + p1 + p2);

	gl_Position = projectionMatrix * viewMatrix * modelMatrix *  vec4(tePosition, 1);

	/*
	gl_Position = vec4(gl_in[0].gl_Position.xyz * gl_TessCoord.x + 
					   gl_in[1].gl_Position.xyz * gl_TessCoord.y + 
					   gl_in[2].gl_Position.xyz * gl_TessCoord.z,
					   1.0);
					   */
}